{include file="common/top" /}
<style>
html{
	background: #ffffff;
}
</style>
<form class="layui-form " action="" style="    background: #fff;">
	<div class="layui-form-item layui-col-space10">
		<label class="layui-form-label" style="width: 9%;">*转出账户ID：</label>
		<div class="layui-col-xs4">
			<select name="out_acc" lay-verify="required" lay-search=""  autocomplete="off">
				<option value="">直接选择或搜索选择</option>
				{volist name="acc_list" id='acc'}
					<option value="{$acc.id}" {eq name='rs.out_acc' value="$acc.id"}selected{/eq}>{$acc.name_id}</option>
				{/volist}
	        </select>
		</div>
		<label class="layui-form-label" style="width: 9%;">*转出账户币：</label>
		<div class="layui-col-xs4">
			<input type="text" name="out_currency" value="{$rs.out_currency}" lay-verify="required" placeholder="请输入要转出账户币" autocomplete="off" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item layui-col-space10">
		<label class="layui-form-label" style="width: 9%;">*转入账户ID：</label>
		<div class="layui-col-xs4">
			<select name="in_acc" lay-verify="required" lay-search=""  autocomplete="off">
				<option value="">直接选择或搜索选择</option>
				{volist name="acc_list" id='acc'}
					<option value="{$acc.id}" {eq name='rs.in_acc' value="$acc.id"}selected{/eq}>{$acc.name_id}</option>
				{/volist}
	        </select>
		</div>
		<label class="layui-form-label" style="width: 9%;">*转入账户币：</label>
		<div class="layui-col-xs4">
			<input type="text" name="in_currency" value="{$rs.in_currency}" lay-verify="required" placeholder="请输入要转入账户币" autocomplete="off" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">*客户返点：</label>
		<div class="layui-col-xs4">
			<input type="text" name="rebate" value="{$rs.rebate}" lay-verify="required"  autocomplete="off" placeholder="请输入客户返点%" class="layui-input">
		</div>
		<label class="layui-form-label">*端口返点：</label>
		<div class="layui-col-xs4">
			<input type="text" name="channel_rebate" value="{$rs.channel_rebate}"  lay-verify="required" placeholder="请输入端口返点%"  autocomplete="off" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">*转账日期：</label>
		<div class="layui-col-xs4">
			<input type="text" name="create_time" value="{$rs.create_time}" id="date" lay-verify="datetime" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
		</div>
		<label class="layui-form-label">*媒介：</label>
		<div class="layui-col-xs4">
			<select name="media_id" lay-verify="required" lay-search=""  autocomplete="off">
				<option value="">直接选择或搜索选择</option>
				{volist name="user_list" id='user'}
					<option value="{$user.id}" {eq name="rs.media_id" value="$user.id"}selected{/eq}>{$user.username}</option>
				{/volist}
	        </select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">*端口：</label>
		<div class="layui-col-xs4">
			<select name="channel_id" lay-verify="required" lay-search=""  autocomplete="off">
				<option value="">直接选择或搜索选择</option>
				{volist name="ch_list" id='ch'}
					<option value="{$ch.id}" {eq name="rs.channel_id" value="$ch.id"}selected{/eq}>{$ch.name}</option>
				{/volist}
	        </select>
		</div>
		<label class="layui-form-label">*客户：</label>
		<div class="layui-col-xs4">
			<select name="customer_id" lay-verify="required" lay-search=""  autocomplete="off">
				<option value="">直接选择或搜索选择</option>
				{volist name="cu_list" id='cu'}
					<option value="{$cu.id}" {eq name="rs.customer_id" value="$cu.id"}selected{/eq}>{$cu.name}</option>
				{/volist}
	        </select>
		</div>
	</div>
	<div class="layui-form-item">
        <label class="layui-form-label">上传凭证：</label>
        <div class="layui-col-xs4">
            <div class="layui-upload-drag" id="test10">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                  <div class="{:$rs['transfer_url']?'':'layui-hide'}" id="uploadDemoView">
                      <hr>
                    <img src="{$rs.transfer_url}" alt="上传成功后渲染" style="max-width: 196px">
                  </div>
            </div>
        </div>
        
    </div>
	<div class="layui-form-item">
		<label class="layui-form-label">备注：</label>
		<div class="layui-col-xs8">
			<textarea name="note" autocomplete="off" placeholder="请输入详细备注" class="layui-textarea">{$rs.note}</textarea>
		</div>
	</div>
	<label class="layui-form-label">特殊说明：</label>
	<div class="layui-form-mid" style="color: red; font-weight: bold;">只能对客户下的账户且客户返点，渠道返点相同，才能进行转账</div>
	<hr />
	<div class="layui-form-item">
		<div class="layui-input-block">
            <input type="hidden" name="transfer_url" value="{$rs.transfer_url}">
            <input type="hidden" name="id" value="{$rs.id}">
			<button class="layui-btn"  lay-submit="" lay-filter="demo1">提交</button>
		</div>
	</div>
	
</form>
{include file="common/footer" /}
<script>
	layui.use(['form', 'layedit', 'laydate','upload'], function(){
		  var form = layui.form ,layer = layui.layer,laydate = layui.laydate,$ = layui.jquery,upload = layui.upload;
		  laydate.render({
			    elem: '#date', //指定元素
			  });
		  //监听提交
		  form.on('submit(demo1)', function(data){
			var articleFrom = data.field;
			layer.load(1, { shade : [ 0.5, '#676a6c' ] }); 
			$.post("{:url('save_acc_transfer')}?t=json",articleFrom,function(data){
				layer.closeAll();
				if (data['code'] == 1) { 
					var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
					parent.layer.close(index1); //再执行关闭 
					//父页面数据 ，重新加载
					parent.get_acc(data['msg']);

				} else {
					layer.msg(data['msg'], { icon : 5 });
				}
			});
			
			return false;
		  });
		 //拖拽上传
		upload.render({
		    elem: '#test10'
		    ,url: '{:url("Upload/index")}' //改成您自己的上传接口
		    ,exts: 'jpg|png|jpeg|gif'
	    	,choose: function(obj){
	    		layer.load(1, { shade : [ 0.5, '#676a6c' ] });
	    	}
		    ,done: function(res){
		    	layer.closeAll();
		    	if(res.code == 0){
		    		layer.msg('上传成功');
				    layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.data);
				    $("input[name=transfer_url]").val(res.data);
		    	}else{
		    		layer.msg(res.msg);
		    	}
		      
		      //console.log(res)
		    }
		});
		
		
	});
	
	
	
</script>
